package com.ay272.ssh2.quartz;


import com.ay272.ssh2.kaoqing.biz.QianBiz;
import com.ay272.ssh2.kaoqing.entity.Qian;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by java on 2016/5/19.
 */
public class MyQianJob implements Job{
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //在数据库里执行签到操作
       /* ApplicationContext ac= new ClassPathXmlApplicationContext("applicationContext.xml");
        QianBiz bi=(QianBiz) ac.getBean("qianBizImpl");
        Qian qian=new Qian ();
        qian.setIp("192.168.18.250");
        SimpleDateFormat f=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        qian.setTime(f.format(new Date()));
        bi.save(qian);
        System.out.println("签到成功");
        */
        //在控制台打印签操作
        SimpleDateFormat f=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        System.out.println(f.format(new Date()));
    }
}
